//
//  JGForgetPwdController.m
//  JGRider
//
//  Created by 单启志 on 2018/3/2.
//  Copyright © 2018年 ffq. All rights reserved.
//

#import "JGForgetPwdController.h"
#import "JGForgetPwdContentView.h"
#import "JGChangePwdApi.h"
#import "JGRequestHelper.h"
@interface JGForgetPwdController ()<JGForgetPwdContentViewDelegate>
@property(nonatomic,strong)JGForgetPwdContentView *contentView;
@end

@implementation JGForgetPwdController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self configSubViews];
}

-(void)configSubViews{
    [self.view addSubview:self.contentView];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - override
-(UIColor *)lmjNavigationBackgroundColor:(LMJNavigationBar *)navigationBar{

    return [UIColor whiteColor];
}

-(BOOL)lmjNavigationIsHideBottomLine:(LMJNavigationBar *)navigationBar{
    return NO;
}

-(NSMutableAttributedString *)lmjNavigationBarTitle:(LMJNavigationBar *)navigationBar{
    
   return [NSMutableAttributedString changeTitle:self.isChangePwd?@"修改密码":@"忘记密码" color:HEXCOLOR(0x404040)];
}

-(UIImage *)lmjNavigationBarLeftButtonImage:(UIButton *)leftButton navigationBar:(LMJNavigationBar *)navigationBar{
    return [UIImage imageNamed:@"signup_icon_return"];
}

- (UIStatusBarStyle)navUIBaseViewControllerPreferStatusBarStyle:(LMJNavUIBaseViewController *)navUIBaseViewController
{
    return UIStatusBarStyleDefault;
}

#pragma mark - contentView delegate
-(void)contentViewValidateCodeEvent{
    
}
-(void)contentViewConfirmEventWithParams:(NSDictionary *)params{

    //忘记密码
    [[JGRequestHelper share]requestWithParams:params requestApi:[JGChangePwdApi class] hudMessage:@"重置密码中..." view:self.view successBlock:^(id result) {
        if ([result[@"data"][@"state"]isEqualToString:@"11204"]) {
            JGpopViewController;
        }
    } faileBlock:nil];
}

#pragma mark - getter
-(JGForgetPwdContentView *)contentView{
    
    if (_contentView==nil) {
        _contentView=[[JGForgetPwdContentView alloc]initWithFrame:CGRectMake(0, self.lmj_navgationBar.height, JGScreenW, JGScreenH-self.lmj_navgationBar.height)];
        _contentView.delegate=self;
    }
    return _contentView;
}
@end
